package pl.cvplus.entity;

import javax.persistence.Basic;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import java.sql.Date;

/**
 * Created by IntelliJ IDEA.
 * User: Piotrek
 * Date: 02.03.12
 * Time: 23:16
 * To change this template use File | Settings | File Templates.
 */
@javax.persistence.Table(name = "cp_education", schema = "public", catalog = "")
@Entity
public class CpEducation {
    private Integer id;

    @javax.persistence.Column(name = "id", nullable = false, insertable = true, updatable = true, length = 10, precision = 0)
    @Id
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    private String educationLevel;

    @javax.persistence.Column(name = "education_level", nullable = true, insertable = true, updatable = true, length = 30, precision = 0)
    @Basic
    public String getEducationLevel() {
        return educationLevel;
    }

    public void setEducationLevel(String educationLevel) {
        this.educationLevel = educationLevel;
    }

    private String schoolName;

    @javax.persistence.Column(name = "school_name", nullable = true, insertable = true, updatable = true, length = 100, precision = 0)
    @Basic
    public String getSchoolName() {
        return schoolName;
    }

    public void setSchoolName(String schoolName) {
        this.schoolName = schoolName;
    }

    private String departmentName;

    @javax.persistence.Column(name = "department_name", nullable = true, insertable = true, updatable = true, length = 100, precision = 0)
    @Basic
    public String getDepartmentName() {
        return departmentName;
    }

    public void setDepartmentName(String departmentName) {
        this.departmentName = departmentName;
    }

    private String course;

    @javax.persistence.Column(name = "course", nullable = true, insertable = true, updatable = true, length = 50, precision = 0)
    @Basic
    public String getCourse() {
        return course;
    }

    public void setCourse(String course) {
        this.course = course;
    }

    private Date startDate;

    @javax.persistence.Column(name = "start_date", nullable = true, insertable = true, updatable = true, length = 13, precision = 0)
    @Basic
    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    private Date stopDate;

    @javax.persistence.Column(name = "stop_date", nullable = true, insertable = true, updatable = true, length = 13, precision = 0)
    @Basic
    public Date getStopDate() {
        return stopDate;
    }

    public void setStopDate(Date stopDate) {
        this.stopDate = stopDate;
    }

    private Boolean stillLearning;

    @javax.persistence.Column(name = "still_learning", nullable = true, insertable = true, updatable = true, length = 1, precision = 0)
    @Basic
    public Boolean getStillLearning() {
        return stillLearning;
    }

    public void setStillLearning(Boolean stillLearning) {
        this.stillLearning = stillLearning;
    }

    private Integer cvFk;

    @javax.persistence.Column(name = "cv_fk", nullable = true, insertable = true, updatable = true, length = 10, precision = 0)
    @Basic
    public Integer getCvFk() {
        return cvFk;
    }

    public void setCvFk(Integer cvFk) {
        this.cvFk = cvFk;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        CpEducation that = (CpEducation) o;

        if (course != null ? !course.equals(that.course) : that.course != null) return false;
        if (cvFk != null ? !cvFk.equals(that.cvFk) : that.cvFk != null) return false;
        if (departmentName != null ? !departmentName.equals(that.departmentName) : that.departmentName != null)
            return false;
        if (educationLevel != null ? !educationLevel.equals(that.educationLevel) : that.educationLevel != null)
            return false;
        if (id != null ? !id.equals(that.id) : that.id != null) return false;
        if (schoolName != null ? !schoolName.equals(that.schoolName) : that.schoolName != null) return false;
        if (startDate != null ? !startDate.equals(that.startDate) : that.startDate != null) return false;
        if (stillLearning != null ? !stillLearning.equals(that.stillLearning) : that.stillLearning != null)
            return false;
        if (stopDate != null ? !stopDate.equals(that.stopDate) : that.stopDate != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id != null ? id.hashCode() : 0;
        result = 31 * result + (educationLevel != null ? educationLevel.hashCode() : 0);
        result = 31 * result + (schoolName != null ? schoolName.hashCode() : 0);
        result = 31 * result + (departmentName != null ? departmentName.hashCode() : 0);
        result = 31 * result + (course != null ? course.hashCode() : 0);
        result = 31 * result + (startDate != null ? startDate.hashCode() : 0);
        result = 31 * result + (stopDate != null ? stopDate.hashCode() : 0);
        result = 31 * result + (stillLearning != null ? stillLearning.hashCode() : 0);
        result = 31 * result + (cvFk != null ? cvFk.hashCode() : 0);
        return result;
    }

    private CpCv cpCvByCvFk;

    @ManyToOne
    public
    @javax.persistence.JoinColumn(name = "cv_fk", referencedColumnName = "id")
    CpCv getCpCvByCvFk() {
        return cpCvByCvFk;
    }

    public void setCpCvByCvFk(CpCv cpCvByCvFk) {
        this.cpCvByCvFk = cpCvByCvFk;
    }
}
